package com.dx.architectureddd.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 线程池配置
 *
 * @author xin.deng
 * @date 2023/09/24
 */
@Configuration
public class ThreadPoolConfig {
    @Bean
    public ThreadPoolExecutor threadPoolExecutor() {
        return new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors() * 2,
                500,
                30,
                TimeUnit.SECONDS, new ArrayBlockingQueue<>(10000));
    }
}
